package com.CST.controller.cb;


import com.CST.common.api.Response;
import com.CST.common.api.ResultObject;
import com.CST.entity.cb.CusUnitArea;
import com.CST.entity.cb.CusUnitAreaExtend;
import com.CST.entity.cb.CusUnitAreaPageInfo;
import com.CST.service.cb.ICusUnitAreaService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;

/**
* @author Nanimono
* @since 2021-12-22
*/
@Api(tags = {"房屋面积"})
@RestController
@RequestMapping("/cusUnitArea")
public class CusUnitAreaController {

    @Autowired
    private ICusUnitAreaService cusUnitAreaService;

    @PostMapping("/listYearAndMonth")
    @ApiOperation("根据年份和月份归档")
    public Response listYearAndMonth(){
        return cusUnitAreaService.listYearAndMonth();
    }

    @PostMapping("/listCusUnitAreaByPage")
    @ApiOperation("分页查询所有信息")
    public ResultObject listCusUnitAreaByPage(@RequestBody CusUnitAreaPageInfo pageInfo){
        return cusUnitAreaService.listCusUnitAreaByPage(pageInfo);
    }
    
    @PostMapping("/updateCusUnitAreaById")
    @ApiOperation("根据id更新CusUnitArea信息")
    public Response updateCusUnitAreaById(@RequestBody CusUnitArea cusUnitArea){
        return cusUnitAreaService.updateCusUnitAreaById(cusUnitArea);
    }
    
    @PostMapping("/deleteCusUnitAreaById")
    @ApiOperation("根据id删除一条CusUnitArea信息")
    public Response deleteCusUnitAreaById(Integer id){
        return cusUnitAreaService.deleteCusUnitAreaById(id);
    }
    
    @PostMapping("/extendLastMonth")
    @ApiOperation("根据传入的当前月份和上一个月份进行继承")
    public Response extendLastMonth(@RequestBody CusUnitAreaExtend cusUnitAreaExtend) {
        return cusUnitAreaService.extendLastMonth(cusUnitAreaExtend);
    }
    
    @PostMapping("/insertCusUnitArea")
    @ApiOperation("插入一条数据")
    public Response insertCusUnitArea(@RequestBody CusUnitArea cusUnitArea){
        return cusUnitAreaService.insertCusUnitArea(cusUnitArea);
    }
    
    @PostMapping("/getCusUnitAreaById")
    @ApiOperation("根据id查询一条数据")
    public ResultObject getCusUnitAreaById(Integer id){
        return cusUnitAreaService.getCusUnitAreaById(id);
    }
}

